<template>
    <svg :class="svgClass" aria-hidden="true">
        <use :xlink:href="iconName" />
    </svg>
</template>

<script>
export default {
    name: 'SvgIcon',
    props: {
        iconClass: {
            type: String,
            required: true,
        },
        className: {
            type: String,
            default: '',
        },
    },
    computed: {
        iconName() {
            return `#icon-${this.iconClass}`;
        },
        svgClass() {
            return `svg-icon ${this.className}`;
        },
    },
};
</script>

<style scoped>
.svg-icon {
    width: 16px;
    height: 16px;
    vertical-align: -0.3em;
    fill: currentColor;
    overflow: hidden;
    margin-right: 5px;
}
</style>